<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    let xuehao = ['101', '102', '103']//学号
    let mingzi = ['小明', '阿伟', '小杰']//姓名
    let chengji = ['89', '99', '88']//性别
    while (true) {
        let num = prompt('欢迎来到学生成绩管理系统，请根据提示来进行操作，1：查询 2：新增 3：修改 4：删除 0：退出 ')
        if (num == '1') {
            let str = ''
            for (let i = 0; i < xuehao.length; i++) {
                str += `学号：${xuehao[i]}-----姓名：${mingzi[i]}-----成绩:${chengji[i]}\n`
            }
            alert(str)
        } else if (num == '2') {
            let newxuehao = prompt('请输入新增的学号')
            let newmingzi = prompt('请输入新增的姓名')
            let newchengji = prompt('请输入新增的成绩')
            xuehao.push(newxuehao)
            mingzi.push(newmingzi)
            chengji.push(newchengji)
            alert('修改成功呢亲~')
        } else if (num == 3) {
            let xiugai = prompt('输入你要修改的学生学号')
            let x = xuehao.indexOf(xiugai)
            if (x != -1) {
                let xiuxue = prompt('修改后的学号')
                xuehao.splice(x, 1, xiuxue)
                let xiuming = prompt('修改后的名字')
                mingzi.splice(x, 1, xiuming)
                let xiucheng = prompt('修改后的成绩')
                chengji.splice(x, 1, xiuming)
                alert('ok！修改成功')
            } else alert('你确定你输对了？')
        }
        else if (num == '4') {
            let d = prompt('输入需要删除的学生的学生号···')
            let p = xuehao.indexOf(d)
            xuehao.splice(p, 1)
            mingzi.splice(p, 1)
            chengji.splice(p, 1)
            alert('ok！清除成功')
        } else if (num == '0') {
            alert('退出成功~古德拜~')
            break

        }
    }

</script>